HAL CORTEX Functions

NVIC management functions

group CORTEX_Exported_Functions_Group1

Functions

void HAL_CORTEX_NVIC_SetPriorityGrouping ( hal_cortex_nvic_priority_group_t prio_grp )

Set the priority grouping field (preemption priority and subpriority) using the required unlock sequence.

Note

When the HAL_CORTEX_NVIC_PRIORITY_GROUP_1 is selected, there is one bit for preemption priority and three bits for sub-priority.

Note

When the HAL_CORTEX_NVIC_PRIORITY_GROUP_2 is selected, there are two bits for preemption priority and two bits for sub-priority.

Note

When the HAL_CORTEX_NVIC_PRIORITY_GROUP_3 is selected, there are three bits for preemption priority and one bit for sub-priority.

Warning

When the HAL_CORTEX_NVIC_PRIORITY_GROUP_0 is selected, IRQ preemption is no longer possible. The pending IRQ priority is managed only by the sub-priority.

Warning

When the HAL_CORTEX_NVIC_PRIORITY_GROUP_4 is selected, IRQ sub-priority is no longer possible. The pending IRQ priority is managed only by the preemption.

Parameters :

prio_grp – The priority grouping bits length. This parameter is an element of hal_cortex_nvic_priority_group_t enumeration.

hal_cortex_nvic_priority_group_t HAL_CORTEX_NVIC_GetPriorityGrouping ( void )

Get the priority grouping field from the NVIC Interrupt Controller.

Return values :

hal_cortex_nvic_priority_group_t – Priority group value.

void HAL_CORTEX_NVIC_SetPriority ( IRQn_Type irqn , hal_cortex_nvic_preemp_priority_t preemp_prio , hal_cortex_nvic_sub_priority_t sub_prio )

Set the priority of an interrupt.

Parameters :
  • irqn – The interrupt number. This parameter can be a value of IRQn_Type enumeration. (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32c5xxxx.h))

  • preemp_prio – Specify the preemption priority for the IRQn channel. This parameter is an element of hal_cortex_nvic_preemp_priority_t enumeration.

  • sub_prio – Specify the subpriority level for the IRQ channel. This parameter is an element of hal_cortex_nvic_sub_priority_t enumeration.

void HAL_CORTEX_NVIC_GetPriority ( IRQn_Type irqn , hal_cortex_nvic_preemp_priority_t * p_preemp_prio , hal_cortex_nvic_sub_priority_t * p_sub_prio )

Get the priority of an interrupt.

Parameters :
  • irqn – The interrupt number. This parameter can be a value of IRQn_Type enumeration. (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32c5xxxx.h))

  • p_preemp_prio – Get the preemption priority for the IRQn channel. This parameter is an element of hal_cortex_nvic_preemp_priority_t enumeration.

  • p_sub_prio – Get the subpriority level for the IRQ channel. This parameter is an element of hal_cortex_nvic_sub_priority_t enumeration.

void HAL_CORTEX_NVIC_EnableIRQ ( IRQn_Type irqn )

Enable the specified interrupt in the NVIC interrupt controller.

Parameters :

irqn – External interrupt number. This parameter can be a value of IRQn_Type. (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32c5xxxx.h))

void HAL_CORTEX_NVIC_DisableIRQ ( IRQn_Type irqn )

Disable the specified interrupt in the NVIC interrupt controller.

Parameters :

irqn – External interrupt number. This parameter can be a value of IRQn_Type. (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32c5xxxx.h))

hal_cortex_nvic_irq_status_t HAL_CORTEX_NVIC_IsEnabledIRQ ( IRQn_Type irqn )

Check whether the specified IRQn is enabled or disabled.

Parameters :

irqn – Specify the interrupt number. This parameter can be a value of IRQn_Type enumeration. (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32c5xxxx.h))

Return values :

hal_cortex_nvic_irq_status_t – Interrupt enable status value.

hal_cortex_nvic_irq_active_status_t HAL_CORTEX_NVIC_IsActiveIRQ ( IRQn_Type irqn )

Check whether an interrupt is active.

Note

Reads the active register in NVIC and returns the active bit.

Parameters :

irqn – Specify the interrupt number. This parameter can be a value of IRQn_Type. (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32c5xxxx.h))

Return values :

hal_cortex_nvic_irq_active_status_t – Interrupt active status value.

void HAL_CORTEX_NVIC_SetPendingIRQ ( IRQn_Type irqn )

Set the pending bit of an external interrupt.

Parameters :

irqn – External interrupt number. This parameter can be a value of IRQn_Type enumeration. (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32c5xxxx.h))

void HAL_CORTEX_NVIC_ClearPendingIRQ ( IRQn_Type irqn )

Clear the pending bit of an external interrupt.

Parameters :

irqn – External interrupt number. This parameter can be a value of IRQn_Type enumeration. (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32c5xxxx.h))

hal_cortex_nvic_irq_pending_status_t HAL_CORTEX_NVIC_IsPendingIRQ ( IRQn_Type irqn )

Check pending interrupt.

Note

Reads the NVIC pending register and returns the pending bit for the specified interrupt.

Parameters :

irqn – External interrupt number. This parameter can be a value of IRQn_Type enumeration. (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32c5xxxx.h))

Return values :

hal_cortex_nvic_irq_pending_status_t – Interrupt pending status value.

void HAL_CORTEX_NVIC_SystemReset ( void )

Initiate a system reset request to reset the MCU.

SYSTICK management functions

group CORTEX_Exported_Functions_Group2

Functions

hal_status_t HAL_CORTEX_SYSTICK_SetFreq ( uint32_t ticks_freq )

Configure the SysTick frequency.

Parameters :

ticks_freq – Specifies the frequency in Hz.

Return values :
  • HAL_OK – Function succeeded.

  • HAL_ERROR – Function failed.

  • HAL_INVALID_PARAM – Invalid parameter.

void HAL_CORTEX_SYSTICK_SetClkSource ( hal_cortex_systick_clk_src_t clk_src )

Configure the SysTick clock source.

Parameters :

clk_src – Specifies the SysTick clock source. This parameter is an element of hal_cortex_systick_clk_src_t enumeration.

void HAL_CORTEX_SYSTICK_Suspend ( void )

Suspend core ticks.

void HAL_CORTEX_SYSTICK_Resume ( void )

Resume core ticks.

void HAL_CORTEX_SYSTICK_IRQHandler ( void )

Handle SYSTICK interrupt request.

void HAL_CORTEX_SYSTICK_Callback ( void )

SYSTICK callback.

MPU management functions

group CORTEX_Exported_Functions_Group3

Functions

void HAL_CORTEX_MPU_Enable ( hal_cortex_mpu_hardfault_nmi_state_t fault_state , hal_cortex_mpu_unmapped_addr_fault_t priv_default_state )

Enable MPU and set the control mode of the MPU during HardFault, NMI, FAULTMASK, and privileged access to the default memory.

Parameters :
void HAL_CORTEX_MPU_Disable ( void )

Disable MPU.

hal_cortex_mpu_status_t HAL_CORTEX_MPU_IsEnabled ( void )

Check whether the MPU is enabled.

Return values :

hal_cortex_mpu_status_t – MPU status value.

void HAL_CORTEX_MPU_SetDeviceMemAttr ( hal_cortex_mpu_mem_attr_idx_t attr_idx , hal_cortex_mpu_device_mem_attr_t mem_attr )

Set the device memory attributes configuration.

Parameters :
hal_cortex_mpu_device_mem_attr_t HAL_CORTEX_MPU_GetDeviceMemAttr ( hal_cortex_mpu_mem_attr_idx_t attr_idx )

Get the device memory attributes configuration.

Parameters :

attr_idx – Specify the attributes index. This parameter is an element of hal_cortex_mpu_mem_attr_idx_t enumeration.

Return values :

hal_cortex_mpu_device_mem_attr_t – Device memory attribute value.

void HAL_CORTEX_MPU_SetCacheMemAttr ( hal_cortex_mpu_mem_attr_idx_t attr_idx , hal_cortex_mpu_normal_mem_cache_attr_t mem_attr )

Set cache memory attributes configuration.

Parameters :
hal_cortex_mpu_normal_mem_cache_attr_t HAL_CORTEX_MPU_GetCacheMemAttr ( hal_cortex_mpu_mem_attr_idx_t attr_idx )

Get the cache memory attributes configuration.

Parameters :

attr_idx – Specify the attributes index. This parameter is an element of hal_cortex_mpu_mem_attr_idx_t enumeration.

Return values :

hal_cortex_mpu_normal_mem_cache_attr_t – Normal memory attribute value.

hal_status_t HAL_CORTEX_MPU_SetConfigRegion ( hal_cortex_mpu_region_idx_t region_idx , const hal_cortex_mpu_region_config_t * p_config )

Set the MPU region configuration.

Parameters :
Return values :
  • HAL_OK – Function succeeded.

  • HAL_INVALID_PARAM – Function failed (HAL_INVALID_PARAM).

void HAL_CORTEX_MPU_GetConfigRegion ( hal_cortex_mpu_region_idx_t region_idx , hal_cortex_mpu_region_config_t * p_config )

Get the MPU region configuration.

Parameters :
void HAL_CORTEX_MPU_EnableRegion ( hal_cortex_mpu_region_idx_t region_idx )

Enable the given MPU region.

Parameters :

region_idx – Specify the region index. This parameter is an element of hal_cortex_mpu_region_idx_t enumeration.

void HAL_CORTEX_MPU_DisableRegion ( hal_cortex_mpu_region_idx_t region_idx )

Disable the given MPU region.

Parameters :

region_idx – Specify the region index. This parameter is an element of hal_cortex_mpu_region_idx_t enumeration.

hal_cortex_mpu_region_status_t HAL_CORTEX_MPU_IsEnabledRegion ( hal_cortex_mpu_region_idx_t region_idx )

Check whether the given MPU region is enabled.

Parameters :

region_idx – Specify the region index. This parameter is an element of hal_cortex_mpu_region_idx_t enumeration.

Return values :

hal_cortex_mpu_region_status_t – MPU region status value.

SCB management functions

group CORTEX_Exported_Functions_Group4

Functions

void HAL_CORTEX_SCB_GetInfo ( hal_cortex_scb_cpuid_info_t * p_info )

Get CPU ID information.

Parameters :

p_info – Pointer to the hal_cortex_scb_cpuid_info_t structure.

void HAL_CORTEX_SCB_EnableHardFaultEscalation ( uint32_t faults )

Enable a fault escalation to HardFault.

Parameters :

faults – This parameter can be a combination of the following values:

void HAL_CORTEX_SCB_DisableHardFaultEscalation ( uint32_t faults )

Disable a fault escalation to HardFault.

Parameters :

faults – This parameter can be a combination of the following values: